package cn.wolfcode.p2p;

import cn.wolfcode.p2p.CoreConfig;
import cn.wolfcode.p2p.web.interceptor.CheckLoginInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Hello world!
 */

@SpringBootApplication
@Import(CoreConfig.class)
@PropertySource("classpath:application-mgrsite.properties")
public class MgrSiteApplication implements WebMvcConfigurer {

    // 注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("======注册拦截器=====");
        registry.addInterceptor(new CheckLoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }

    public static void main(String[] args) {
        SpringApplication.run(MgrSiteApplication.class, args);
    }
}
